﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TemplateUser.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="ManageBanking.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <link href="../../../../Content/css/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Content/css/SucErr.css" rel="stylesheet" type="text/css" />
    <script src="../../../../Scripts/functions.js" type="text/javascript"></script>

    <script src="../../../../Scripts/wysiwyg.js" type="text/javascript"></script>
    <script src="../../../../Scripts/jquery.validate.js" type="text/javascript"></script>
    
    
    
    
  <script type="text/javascript">

      var a = 0;
      var b = 0;
      var c = 0;
      var d = 0;
      $(document).ready(function() {

          $("#money").keyup(function() {
              var status = $("#divcheck");
              status.html("");
              a == 0;
              $('#a').attr("value", 0);

          });
          $("#money").blur(function() {

              var name = $("#money").val();
              var name1 = $("#ttmoney").val();

              var status = $("#divcheck");

              status.html("Checking....").removeClass(); ;

              $.post("/T_Account/CheckMoney", { money: name, ttmoney: name1 },

                    function(data) {

                        if (data == true) {

                            status.html("Money is Valid!!!!!!!").addClass("green");
                            a == 1;
                            $('#a').attr("value", 1);

                        } else {

                            status.html("Money Is InValid!!!!!!!!!!").addClass("red");
                            a == 0;
                            $('#a').attr("value", 0);
                        }

                    });

          });
          $('#f1').submit(function() {
              a = $('#a').attr("value");
              b = $('#b').attr("value");

              if (b == 0) {
                  alert("Please Check Date Receive");
                  return false;
              }
              else if (a == 0) {
                  alert("Pleae Check Money Transfer,Or It's Invalid");
                  return false;
              }
              else if (a == 1 && b == 1) {
              if (confirm("Are you sure"))
                return true;
              }
              return false;
          });

      });
    </script>
    <script type="text/javascript">

        $(document).ready(function() {

        $("#Date").click(function() {
                var status = $("#DivMoney");
                status.html("");
                $('#b').attr("value", 0);
            });
            $("#Check").click(function() {

                var name = $("#Date").val();
                
                var status = $("#DivCheckDate");

                status.html("Checking....").removeClass(); ;

                $.post("/T_Account/CheckDate", { Date: name },

                    function(data) {

                        if (data == true) {

                            status.html( "Date is Valid!!!!!!!").addClass("green");
                            $('#b').attr("value", 1);

                        } else {

                            status.html("Date Must Be In 1 Week").addClass("red1");
                            $('#b').attr("value", 0);

                        }

                    });

            });

        });
    </script>
    
	<script language="javascript" type="text/javascript">
	    $(document).ready(function() {

	        $('#f1').validate({
	            rules: {
	                name: {
	                    required: true
	                },
	                Address: {
	                    required: true
	                    
	                },
	                
	               
	                money: {
	                    required: true,
	                    number: true

	                },
	               Date: {
	                    required: true
	                }
	               




	            }, //ket thuc rules
	            messages: {
	            name: {
	                required: "Name Can Not Be Null"
	            },
	            Address: {
	                required: "Address Can Not Be Null"

	            },


	            money: {
	                required: "Money To Cheque Can Not Be Null",
	                number: "Money Must Be Number"

	            },
	            Date: {
	                required: "Date Cheque Can Not Be Null"
	            }




	            }
	        });  // ket thuc validate

	        // $('#oldpassword').keyup(function() {
	        //         $('#messge_error').html("");
	        //    });


	    });
	    $(document).ready(function() {

	    $('#Date').datepicker({
	            showButtonPanel: true,
	            changeMonth: true,
	            changeYear: true,
	            dateFormat: 'yy-mm-dd',
	            yearRange: '2012:2020'

	        });
	    });             // ket thuc ready
    </script>
    <style type="text/css">
       .ui-autocomplete
       {
       
       	margin-left:760px;
       	margin-top:208px
              
       }
        .green

        {
            float:left;
            color: Green;
            margin-left:218px;
            margin-top:-9px;
        }

        .red

        {   float:left;
            margin-left:168px !important;
            color: Red;
            margin-top:-9px;
        }
        .red1

        {   float:left;
            margin-left:2px !important;
            color: Red;
            margin-top:-9px;
        }
        #divcheck
        {
        float:left;
        margin-left:14px;
        margin-top:-9px;	
        }
        .btnCheck
        {
        margin-left:11px;	
        	
        }
        .spancenter
        {
        margin-left:-64px;	
        }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


     <div class="center_block_top"><span>&nbsp;</span><h3>Add Cheque</h3></div>
<div class="center_block_mau"><!--section-->
	<div id="intro">
<blockquote>
<% if (ViewData["Res2"] != null)
           {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Your Cheque Create Succesfully</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%if (ViewData["Res22"] != null)
      { %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Res22"]%></p>
					</div>
				</div>
				<%} %>
  <div class="redistry">
  
  		<%using (Html.BeginForm("ResolveCheque", "Cheque", FormMethod.Post, new { @id = "f1" }))
      { %>
      
      <% Username us = (Username)Session["Login"];
         decimal money = (decimal)ViewData["Money"];
          
       %>
      <input id="Hidden1" type="hidden" name="totalmoney" value="<%= money %>" />
      <input id="Hidden2" type="hidden" name="idusername" value="<%=us.IdUsername %>" />
      <input id="Hidden3" type="hidden" name="idaccount" value="<%=ViewData["IdAccount"] %>" />
      
  		<ul>
  		 <li>
  		 
            	    <span>Your Account:</span>
            	    <span class="spancenter"><%= ViewData["IdAccount"]%></span>
                    <input id="idacc" name="idacc" value="<%= ViewData["IdAccount"] %>" type="hidden" />
                    <input id="ttmoney" name="ttmoney"  value="<%= ViewData["Money"] %>" type="hidden" />
                 <input id="a" type="hidden" />
                 <input id="b" type="hidden" />
            	</li>
            	<li>
            	    <span>Total Money:</span>
            	    <span class="spancenter"><%= ViewData["Money"]%></span>
            	</li>
        	<li>
            	<span>Name</span>
            	<div class="input_text"></div>
            	<div><input id="name" name="name" id="uname" type="text" size="20" />
            	
            	</div>
            	<div></div></li>
            <li>
            	<span>Address</span>
            	<div class="input_text"></div>
            	<div><input id="Address" name="Address" id="Text1" type="text" size="20" />
            	
            	</div>
            	<div></div></li>
            
             <li>
            	<span>Money Transfer</span>
            	<div class="input_text"></div>
            	<div><input id="money" name="money" id="Text2" type="text" size="20" />
            	
            	</div>
            	<div></div>
            	
                <div id="divcheck" class="error" visible="true"></div>
            	
            	</li>
            	
            <li>
            	<span>DateReceive</span>
            	<div class="input_text"></div>
            	<div><input id="Date" name="Date"  readonly="readonly" type="text" size="20" />
            	
            	</div>
            	<div></div>
            	<div class="check1">
            	<a id="Check" href="#"> Check</a>
            	
            	</div>
            
            	
                <input id="d" type="hidden" value="0" />
            	
                <div id="DivCheckDate" class="error" visible="true"></div>
            	
            	</li>
            
            <li>
            
            	<span>&nbsp;</span>
                <ul>
                	<li ><input type="submit" id="sub1" name="button" value="OK" class="ok"/></li>
                    <li id="cancel" ><input type="reset" name="button" value="Reset" class="ok" /></li>
                </ul>
            </li>
        </ul>
        <%} %>
        
  </div>
  
  
  
</blockquote>
<div class="clearBoth"></div>
<blockquote>
 
</blockquote>
</div>
<!--//intro-->
</div>
<div class="center_block_bottom_mau"></div>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScript" runat="server">
    

</asp:Content>
